<?php

use App\Kuafu\Pay\Service\PayConfigService;

/*
 * 生成wx_cert.pem方法
 * php /Users/shalaaoao/www/t/rms-api/vendor/bin/CertificateDownloader.php -k {证书秘钥} -m {商户号} -f /Users/shalaaoao/Downloads/1622304477_20220303_cert/apiclient_key.pem -s {证书序列号} -o /Users/shalaaoao/Downloads/WxCert.php
 * */

return [
    'fy'     => [ // 富友支付
        'host'       => env('FY_HOST'),
        'notify_url' => env('GATEWAY_URL') . '/api/pay/callback/fy/pay',
        'privateKey' => env('FY_PRIVATE_KEY'),
        'insCd'      => env('FY_INS_CD')
    ],
    'ali'    => [ // 支付宝直连
        'moudulePath' => $aliModulePath = app_path() . '/Kuafu/Pay/Channel/AliPay/Key/',
        'notifyUrl'   => env('GATEWAY_URL') . '/api/pay/callback/alipay/appPay',

        // 每个公司的配置
        'company'     => [
            PayConfigService::COMPANY_TJ_SUPPLER_CHAIN => [
                'host'               => 'openapi.alipay.com',
                'appId'              => '2021002193656249',
                'merchantPrivateKey' => rtrim(file_get_contents($aliModulePath . "AppSub/supplerChain/merchantPrivateKey"),
                    "\n"),
                'alipayPublicKey'    => rtrim(file_get_contents($aliModulePath . "AppSub/supplerChain/alipayPublicKey"),
                    "\n"),
                'notifyUrl'          => env('GATEWAY_URL') . '/api/pay/callback/alipay/appPay',
                'encryptKey'         => '',
            ],
            PayConfigService::COMPANY_FRIED_IDEA       => [
                'host'               => 'openapi.alipay.com',
                'appId'              => '2021003122648887',
                'merchantPrivateKey' => rtrim(file_get_contents($aliModulePath . "AppSub/friedIdea/merchantPrivateKey"),
                    "\n"),
                'alipayPublicKey'    => rtrim(file_get_contents($aliModulePath . "AppSub/friedIdea/alipayPublicKey"),
                    "\n"),
                'notifyUrl'          => env('GATEWAY_URL') . '/api/pay/callback/alipay/appPay',
                'encryptKey'         => 'Sq7GesoCdYmJ+PNeZepQFw==',
            ],
            PayConfigService::COMPANY_DIGITAL_TECH     => [
                'host'               => 'openapi.alipay.com',
                'appId'              => '2021002193644013',
                'merchantPrivateKey' => rtrim(file_get_contents($aliModulePath . "AppSub/digitalTech/merchantPrivateKey"),
                    "\n"),
                'alipayPublicKey'    => rtrim(file_get_contents($aliModulePath . "AppSub/digitalTech/alipayPublicKey"),
                    "\n"),
                'notifyUrl'          => env('GATEWAY_URL') . '/api/pay/callback/alipay/appPay',
                'encryptKey'         => '1nn+ztICAz1I2VowMMj7uQ==',
            ],
//            PayConfigService::COMPANY_ALI_SAND         => [
//                'host'               => 'openapi.alipaydev.com',
//                'appId'              => '2021000118648888',
//                'merchantPrivateKey' => rtrim(file_get_contents($aliModulePath . "AppSub/sand/merchantPrivateKey"),
//                    "\n"),
//                'alipayPublicKey'    => rtrim(file_get_contents($aliModulePath . "AppSub/sand/alipayPublicKey"),
//                    "\n"),
//                'notifyUrl'          => env('GATEWAY_URL') . '/api/pay/callback/alipay/appPay',
//                'encryptKey'         => 'bAb0Bl0dUHr1+Zt3xPVZvQ==',
//            ],
            PayConfigService::COMPANY_ALI_SAND         => [
                'host'               => 'openapi-sandbox.dl.alipaydev.com',
                'appId'              => '9021000123600335',
                'merchantPrivateKey' => rtrim(file_get_contents($aliModulePath . "AppSub/sandV2/merchantPrivateKey"),
                    "\n"),
                'alipayPublicKey'    => rtrim(file_get_contents($aliModulePath . "AppSub/sandV2/alipayPublicKey"),
                    "\n"),
                'notifyUrl'          => env('GATEWAY_URL') . '/api/pay/callback/alipay/appPay',
                'encryptKey'         => 'ZkSFyKzNhBU7wrcSR1mvfg==',
            ],
            PayConfigService::COMPANY_HN_FRUIT         => [
                'host'               => 'openapi.alipaydev.com',
                'appId'              => '2021003123616012',
                'merchantPrivateKey' => rtrim(file_get_contents($aliModulePath . "AppSub/hnFruit/merchantPrivateKey"),
                    "\n"),
                'alipayPublicKey'    => rtrim(file_get_contents($aliModulePath . "AppSub/hnFruit/alipayPublicKey"),
                    "\n"),
                'notifyUrl'          => env('GATEWAY_URL') . '/api/pay/callback/alipay/appPay',
                'encryptKey'         => 'J/MNw9lD1a5IBWznRN/gIw==',
            ],
        ],
    ],
    'wx'     => [ // 微信直连
        'modulePath' => $wxModulePath = app_path() . '/Kuafu/Pay/Channel/WxPay/Key/',

        // 公众号
        'official'   => [
            'app_id'     => env('WECHAT_PUBLIC_APPID'),
            'app_secret' => env('WECHAT_PUBLIC_SECRET'),
        ],

        // 小程序
        'mini'       => [
            'app_id' => env('WECHAT_APPID'),
        ],

        // 支付成功回调地址
        'notify_url' => [
            'pay' => env('GATEWAY_URL') . '/api/pay/callback/wx/pay',
        ],

        // 每个公司的配置
        'company'    => [
            PayConfigService::COMPANY_TJ_SUPPLER_CHAIN => [
                'mch_id'        => '1604332973',
                'app_id'        => 'wxaba0174131776352',
                'api_key'       => 'N2MkvjmQV3hA4mQXHdFzNuRX5mtEiYLK', // 证书的密码
                'api_key_v2'    => '5580078788948e40508de0e876147dfd', // 证书的密码
                'ssl_cert_path' => $wxModulePath . "AppSub/supplerChain/apiclient_cert.pem",
                'ssl_key_path'  => $wxModulePath . "AppSub/supplerChain/apiclient_key.pem",
                'wx_cert_path'  => $wxModulePath . "AppSub/supplerChain/wx_cert.pem",
            ],
            PayConfigService::COMPANY_FRIED_IDEA       => [
                'mch_id'        => '1622304477',
                'app_id'        => 'wxaba0174131776352',
                'api_key'       => 'QlAxSwQzykUHqw12lH5MN9KAsTzf4fIl', // 证书的密码
                'api_key_v2'    => 'QlAxSwQzykUHqw12lH5MN9KAsTzf4fIl', // 证书的密码
                'ssl_cert_path' => $wxModulePath . "AppSub/friedIdea/apiclient_cert.pem",
                'ssl_key_path'  => $wxModulePath . "AppSub/friedIdea/apiclient_key.pem",
                'wx_cert_path'  => $wxModulePath . "AppSub/friedIdea/wx_cert.pem",
            ],
            PayConfigService::COMPANY_DIGITAL_TECH     => [
                'mch_id'        => '1612535016',
                'app_id'        => 'wxaba0174131776352',
                'api_key'       => 'Yw99KDwL7TkfBL8fXnWIGBseSqbLofNg', // 证书的密码
                'api_key_v2'    => 'Yw99KDwL7TkfBL8fXnWIGBseSqbLofNg', // 证书的密码
                'ssl_cert_path' => $wxModulePath . "AppSub/digitalTech/apiclient_cert.pem",
                'ssl_key_path'  => $wxModulePath . "AppSub/digitalTech/apiclient_key.pem",
                'wx_cert_path'  => $wxModulePath . "AppSub/digitalTech/wx_cert.pem",
            ],

            PayConfigService::COMPANY_HN_FRUIT => [
                'mch_id'        => '1601850035',
                'app_id'        => 'wxaba0174131776352',
                'api_key'       => 'CAuuvS3GsSHHP6heFGb50Zo7PVLksMPd', // 证书的密码
                'api_key_v2'    => 'CAuuvS3GsSHHP6heFGb50Zo7PVLksMPd', // 证书的密码
                'ssl_cert_path' => $wxModulePath . "AppSub/hnFruit/apiclient_cert.pem",
                'ssl_key_path'  => $wxModulePath . "AppSub/hnFruit/apiclient_key.pem",
                'wx_cert_path'  => $wxModulePath . "AppSub/hnFruit/wx_cert.pem",
            ],
            PayConfigService::COMPANY_XM_SUPPLER_CHAIN => [
                'mch_id'        => '1669653381',
                'app_id'        => 'wxaba0174131776352',
                'api_key'       => 'WXT0BLLutwnglyCyb52qGWTY1H3YDAc8', // 证书的密码
                'api_key_v2'    => 'WXT0BLLutwnglyCyb52qGWTY1H3YDAc8', // 证书的密码
                'ssl_cert_path' => $wxModulePath . "AppSub/xmSupplerChain/apiclient_cert.pem",
                'ssl_key_path'  => $wxModulePath . "AppSub/xmSupplerChain/apiclient_key.pem",
                'wx_cert_path'  => $wxModulePath . "AppSub/xmSupplerChain/wx_cert.pem",
            ],
        ],
    ],
    'mybank' => [
        'isvOrgId' => env('MYBANK_ISV_ORG_ID'),
        'appid'    => env('MYBANK_APPID'),
        'bankCard' => env('MYBANK_SUPERVISE_BANK_CARD'),

        'bkServerUrl' => env('MYBANK_BK_SERVER_URL'),
        'sbServerUrl' => env('MYBANK_SB_SERVER_URL'),

        'bkUploadServerUrl' => env('MYBANK_BK_UPLOAD_SERVER_URL'),


        'privateKey' => env('MYBANK_PRIVATE_KEY'),
        'publicKey'  => env('MYBANK_PUBLIC_KEY'),

        'kfosMerchantId' => env('MYBANK_KFOS_MERCHANT_ID'),
    ]
];
